<?php

namespace App\Observers;

use App\Models\Administrator;
use App\Models\UserGroup;
use App\Models\XXlBaseForm;
use Carbon\Carbon;
use Illuminate\Support\Facades\Cache;


/*
[
    1, |
    2, |
    3, |
    4, |
]


 */

/**
 * Class XXLBaseFormObserver
 * @package App\Observers
 */
class XXLBaseFormObserver
{
    public function created(XXlBaseForm $form)
    {
        if ($form->group_id && $group = UserGroup::find($form->group_id)) {
            $user = $group->dispatchOnlineUser();
            if ($user) {
                $form->user()->sync($user->id);
                $user->userGetOne($user['cache_key']);
            }
        }
    }
}
